@extends('admin.public.layout')
@section('title', '角色列表')

@section('css')

@endsection

@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <form class="pull-left search-bar" method="post" action="{{ url('admin/role/index')}}">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
                        <div class="col-xs-3 m-t-10">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">角色名称</span>
                                <input type="text" class="form-control" name="keyword" placeholder="请输入角色名称" aria-describedby="basic-addon1" value="<?php if(!empty($params['keyword'])){ ?>{{$params['keyword']}}<?php }?>">
                            </div>
                        </div>
                        <div class="col-xs-3 m-t-10 pull-left">
                            <div class="input-group">
                                <button class="btn btn-info btn-w-xs m-r-10" type="submit">查询</button>
                                <button class="btn btn-secondary btn-w-xs m-r-10 reset-btn" type="button">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-toolbar clearfix">
                    <?php if(in_array('role_add',Session::get('role_menu_action'))){ ?>
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" href="{{url('admin/role/add')}}"><i class="mdi mdi-plus"></i> 新增</a>
                    </div>
                    <?php } ?>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-striped">
                            <thead>
                            <tr>
                                <th style="width: 50px;">
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" id="check-all"><span></span>
                                    </label>
                                </th>
                                <th width="20%">角色名称</th>
                                <th width="30%">描述</th>
                                <th width="15%">创建时间</th>
                                <th width="15%">更新时间</th>
                                <th width="15%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if (count($list) > 0)
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>
                                            @if($v->id != 1)
                                            <label class="lyear-checkbox checkbox-primary">
                                                <input type="checkbox" name="ids[]" value="{{$v->id}}"><span></span>
                                            </label>
                                            @endif
                                        </td>
                                        <td>{{$v->role_name}}</td>
                                        <td>{{$v->remark}}</td>
                                        <td>
                                            @if(!empty($v->create_time))
                                                <?php echo date('Y-m-d H:i:s',$v->create_time)?>
                                            @endif
                                        </td>
                                        <td>
                                            @if(!empty($v->update_time))
                                                <?php echo date('Y-m-d H:i:s',$v->update_time)?>
                                            @endif
                                        </td>
                                        <td>
                                            <div class="btn-group">
                                                @if($v->id != 1)
                                                    <?php if(in_array('role_edit',Session::get('role_menu_action'))){ ?>
                                                    <a class="btn btn-xs btn-default m-r-5" href="{{route('admin.role.edit', ['id'=>$v->id])}}" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
                                                    <?php } ?>
                                                    <?php if(in_array('role_delete',Session::get('role_menu_action'))){ ?>
                                                    <a class="btn btn-xs btn-default m-r-5 del-btn" data-href="{{route('admin.role.delete')}}" data-confirm="确定删除角色?" data-id="{{$v->id}}" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-delete"></i></a>
                                                    <?php } ?>
                                                @endif
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr>
                                    <td colspan="6" style="text-align: center;color:#ff0000;">查询数据不存在！</td>
                                </tr>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    {!! $pager !!}
                </div>
            </div>
        </div>
    </div>
@endsection

@section('js')

@endsection